package io.gitee.yxsnake.framework.core.enums;

import io.gitee.yxsnake.framework.core.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author snake
 * @description 设备类型 针对一套 用户体系
 * @since 2024/11/2 19:14
 */
@Getter
@AllArgsConstructor
public enum DeviceType {

    /**
     * pc端
     */
    PC("pc"),

    /**
     * app端
     */
    APP("app"),

    /**
     * 小程序端
     */
    XCX("xcx");

    private final String device;

    public static DeviceType getInstance(String str) {
        for (DeviceType value : values()) {
            if (StringUtils.contains(str, value.getDevice())) {
                return value;
            }
        }
        throw new RuntimeException("'DeviceType' not found By " + str);
    }
}
